Import all the libraries we need


In [ ]:
import tidegates
from tidegates import utils

Perform the analysis

The toolboxes are capable of evaluating

  1. the extent and area of flooding
  2. the number of buildings that recieve some amount of flooding
  3. the extent and area of flooding within wetlands.

The cell below will do all of that, and count the number of distinct wetlands impacted by each flood


In [ ]:
# common parameters
workspace = r'F:\phobson\Tidegates\MB_Small.gdb'
flood_elev = 13.8 # ft MSL
flood_output = 'Example_flood'
id_col = 'GeoID'

with utils.WorkSpace(workspace), utils.OverwriteState(True):
    
    # estimate the spatial extent of the floods
    flooded_zones = tidegates.flood_area(
        dem='dem_x08',
        zones='ZOI',
        ID_column=id_col,
        elevation_feet=flood_elev,
        filename=flood_output,
    )
    
    # add a field to the output's attribute table indicating the flood elevation
    utils.add_field_with_value(
        table=flood_output,
        field_name='flood_elev',
        field_value=flood_elev,
    )
    
    # count the number of buildings impacted
    tidegates.count_of_impacts(
        floods_path=flood_output,
        flood_idcol=id_col,
        assets_input='buildings', # building footprint layer in the GeoDB,
        asset_idcol='STRUCT_ID', # unique field for each building
        fieldname='N_bldgs', # name of the field we'll add to 'Example_flood'
    )

    # count the number of wetlands impacted
    tidegates.count_of_impacts(
        floods_path=flood_output,
        flood_idcol=id_col,
        assets_input='wetlands', # wetlands layer in the GeoDB
        asset_idcol='WETCODE', # unique field for each wetland
        fieldname='N_wtlds', # name of the field we'll add to 'Example_flood'
    )    

    # sum up the area of impacted wetlands behind each tidegate
    tidegates.area_of_impacts(
        floods_path=flood_output,
        flood_idcol=id_col,
        assets_input='wetlands', # wetlands layer in the GeoDB
        fieldname='area_wtlds', # name of the field we'll add to 'Example_flood'
    )